<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	
	class Demos extends CI_Controller {
		
		
		
		
		
		/**
		 * 
		 * __construct
		 */
		public function __construct () {
			parent::__construct();
		}
		// end: __construct
		
		
		
		
		
		/**
		 * 
		 * index
		 */
		public function index () {
			
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$index_data = array(
					
				);
				
				// beg: switching between user type demo
				switch ( $this->session->userdata('cisco_session_usertype') ) {
					
					// beg: user-root
					case 'root':
						$this->load->view('demos/root/demos-index', $index_data);
						break;
					// end: user-root
					
					// beg: user-stats
					case 'stats':
						$this->load->view('demos/stats/demos-index', $index_data);
						break;
					// end: user-stats
					
					// beg: user-user
					case 'user':
					default:
						$this->load->view('demos/user/demos-index', $index_data);
					// end: user-user
				}
				// end: switching between user type demo
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: index
		
		
		
		
		
		/**
		 * 
		 * fixed
		 */
		public function fixed () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$index_data = array(
					
				);
				
				
				$this->load->view('demos/user/demos-fixed', $index_data);
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: fixed
		
		
		
		
		
		/**
		 * 
		 * movil
		 */
		public function movil () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$index_data = array(
					
				);
				
				
				$this->load->view('demos/user/demos-movil', $index_data);
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: movil
		
		
		
		
		
		/**
		 * 
		 * add_fixed
		 * 
		 * method to show the add demo form and manage the 
		 * validation of fields
		 */
		public function add_fixed () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$add_data = array(
					'get_' => $this->input->get()
				);
				
				// beg: switching between user type demo
				switch ( $this->session->userdata('cisco_session_usertype') ) {
					
					// beg: user-root
					case 'root':
						$this->load->view('demos/root/demos-add-demo', $add_data);
						break;
					// end: user-root
					
					// beg: user-stats
					case 'stats':
						$this->load->view('demos/stats/demos-add-demo', $add_data);
						break;
					// end: user-stats
					
					// beg: user-user
					case 'user':
					default:
						$this->load->view('demos/user/demos-add-fixed-demo.php', $add_data);
					// end: user-user
				}
				// end: switching between user type demo
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: add_fixed
		
		
		
		
		
		/**
		 * 
		 * add_fixed_attempt
		 * 
		 * method to attempt to add fixed demo
		 */
		public function add_fixed_attempt () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$add_data = array(
					'get_' => $this->input->get()
				);
				
				// beg: switching between user type demo
				switch ( $this->session->userdata('cisco_session_usertype') ) {
					
					// beg: user-root
					case 'root':
						$this->load->view('demos/root/demos-add-demo', $add_data);
						break;
					// end: user-root
					
					// beg: user-stats
					case 'stats':
						$this->load->view('demos/stats/demos-add-demo', $add_data);
						break;
					// end: user-stats
					
					// beg: user-user
					case 'user':
					default:
						$this->load->view('demos/user/demos-add-fixed-demo-success', $add_data);
					// end: user-user
				}
				// end: switching between user type demo
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: add_fixed_attempt
		
		
		
		
		
		/**
		 * 
		 * add_movil
		 * 
		 * method to show the add demo form and manage the 
		 * validation of fields
		 */
		public function add_movil () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				$add_data = array(
					'get_' => $this->input->get()
				);
				
				// beg: switching between user type demo
				switch ( $this->session->userdata('cisco_session_usertype') ) {
					
					// beg: user-root
					case 'root':
						$this->load->view('demos/root/demos-add-demo', $add_data);
						break;
					// end: user-root
					
					// beg: user-stats
					case 'stats':
						$this->load->view('demos/stats/demos-add-demo', $add_data);
						break;
					// end: user-stats
					
					// beg: user-user
					case 'user':
					default:
						$this->load->view('demos/user/demos-add-movil-demo.php', $add_data);
					// end: user-user
				}
				// end: switching between user type demo
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: add_movil
		
		
		
		
		
		/**
		 * 
		 * type
		 * 
		 * method to show the add demo form and manage the 
		 * validation of fields
		 */
		public function type () {
			// if user is logged in
			if ( $this->common->is_logged_in() ) {
				
				// loading the top of the view
				$this->load->view('templates/template-web-top');
				
				foreach ( $_POST as $key => $value)
					echo $key . ' => ' . $value . '<br />';
				
				$type_data = array(
					'get_' => $this->input->get()
				);
				
				// beg: switching between user type demo
				switch ( $this->session->userdata('cisco_session_usertype') ) {
					
					// beg: user-root
					case 'root':
						$this->load->view('demos/root/demos-types', $type_data);
						break;
					// end: user-root
					
					// beg: user-stats
					case 'stats':
						$this->load->view('demos/stats/demos-types', $type_data);
						break;
					// end: user-stats
					
					// beg: user-user
					case 'user':
					default:
						$this->load->view('demos/user/demos-types', $type_data);
					// end: user-user
				}
				// end: switching between user type demo
				
				// loading the bottom of the view
				$this->load->view('templates/template-web-bottom');
			}
			
			// if user is not logged in
			else
				redirect('sessions/login/?redirect_to=' . urlencode(current_url()) . '', 'location');
		}
		// end: add
	}
